using System;
using System.Linq.Expressions;
using FluentSilverlight.Expressions;
using FluentSilverlight.Expressions.Buttons;
using FluentSilverlight.Expressions.Grid;
using FluentSilverlight.Expressions.Lists;
using FluentSilverlight.Expressions.Panels;
using FluentSilverlight.Expressions.TextItems;

namespace FluentSilverlight
{
    public static class OpinatedControlExtensions
    {
        public static TextBoxExpression<TModel> TextBoxFor<TModel>(this IOpinionatedControl<TModel> view, Expression<Func<TModel, object>> expression)
            where TModel : class
        {
            return new TextBoxExpression<TModel>(view.Model, expression);
        }

        public static TextBlockExpression<TModel> TextBlockFor<TModel>(this IOpinionatedControl<TModel> view, Expression<Func<TModel, object>> expression)
            where TModel : class
        {
            return new TextBlockExpression<TModel>(expression);
        }

        public static TextBlockExpression<TModel> TextBlockFor<TModel>(this IOpinionatedControl<TModel> view, string text)
            where TModel : class
        {
            return new TextBlockExpression<TModel>(text);
        }

        public static ButtonExpression<TModel> Button<TModel>(this IOpinionatedControl<TModel> view, string content)
            where TModel : class
        {
            return new ButtonExpression<TModel>(view.Model, content);
        }

        public static ListBoxExpression<TModel> ListBox<TModel>(this IOpinionatedControl<TModel> view)
            where TModel : class
        {
            return new ListBoxExpression<TModel>(view.Model);
        }

        public static ListBoxExpression<TModel> ListBox<TModel>(this IOpinionatedControl<TModel> view, string name)
            where TModel : class
        {
            return new ListBoxExpression<TModel>(view.Model, name);
        }

        public static ButtonExpression<TModel> Button<TModel>(this IOpinionatedControl<TModel> view, string name, string content)
            where TModel : class
        {
            return new ButtonExpression<TModel>(view.Model, name, content);
        }

        public static HyperlinkButtonExpression<TModel> HyperLink<TModel>(this IOpinionatedControl<TModel> view, string content)
            where TModel : class
        {
            return new HyperlinkButtonExpression<TModel>(view.Model, content);
        }

        public static HyperlinkButtonExpression<TModel> HyperLink<TModel>(this IOpinionatedControl<TModel> view, string name, string content)
            where TModel : class
        {
            return new HyperlinkButtonExpression<TModel>(view.Model, name, content);
        }

        public static GridExpression<TModel> GridFor<TModel>(this IOpinionatedControl<TModel> view)
            where TModel : class
        {
            return new GridExpression<TModel>("Grid_" + Guid.NewGuid());
        }

        public static GridExpression<TModel> GridFor<TModel>(this IOpinionatedControl<TModel> view, string name)
            where TModel : class
        {
            return new GridExpression<TModel>(name);
        }

        public static StackPanelExpression<TModel> StackPanelFor<TModel>(this IOpinionatedControl<TModel> view)
            where TModel : class
        {
            return new StackPanelExpression<TModel>();
        }

        public static StackPanelExpression<TModel> StackPanelFor<TModel>(this IOpinionatedControl<TModel> view, string name)
            where TModel : class
        {
            return new StackPanelExpression<TModel>(name);
        }
    }
}